package com.wenkang.stu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wenkang.stu.pojo.SysRole;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author WenKangCao
 * @since 2021-03-20
 */
public interface RoleMapper extends BaseMapper<SysRole> {

    @Select("SELECT\n" +
            "\tr.* \n" +
            "FROM\n" +
            "\tsys_role r,\n" +
            "\tsys_user_role ur \n" +
            "WHERE\n" +
            "\tr.id = ur.role_id \n" +
            "\tAND ur.user_id = #{userId}")
    List<SysRole> selectByUserId(Integer userId);
}
